//
// Created by 陈成 on 2019/9/19.
//

#ifndef RV32I_CPU_KERNEL_H
#define RV32I_CPU_KERNEL_H

#include "systemc.h"
#include "InstB.h"
#include "InstI.h"
#include "InstJ.h"
#include "InstR.h"
#include "InstS.h"
#include "InstU.h"

class Kernel {
public:
    Kernel(RegBank<REG_NUM> *r, RegBank<CSR_NUM> *csr, Mem *m);
    ~Kernel();

    void
    loadFromFile(const char *filename);

    void exec();

private:
    std::vector<Inst *> insts;
    RegBank<REG_NUM>  *r;
    RegBank<CSR_NUM> *csr;
    Mem *m;

    Inst *
    preProcessInst(uint32_t pc, sc_bv<32> inst);

    void exec(uint32_t pc);
};


#endif //RV32I_CPU_KERNEL_H
